export default {
	props: {
		fieldKey: {
			type:String,
			default:function(){return ''}
		},
		inputDataObj:{
			type:Object,
			default:function(){return {}}
		},
	},
	data() {
		var css = {}
		var attribute = {}
		var urlData = this.inputDataObj.urlData.data
		var fieldsConstruction = {}
		var val = ''
		var datas = []
		if(urlData.fieldsConstructionMaps && urlData.fieldsConstructionMaps[this.fieldKey]){
			fieldsConstruction = urlData.fieldsConstructionMaps[this.fieldKey]
			if(fieldsConstruction.attribute){
				if(fieldsConstruction.attribute.css){
					try{
						if(typeof fieldsConstruction.attribute.css == 'string'){
							css = JSON.parse(fieldsConstruction.attribute.css)
						}
					}catch(e){
						//TODO handle the exception
					}
				}
				if(fieldsConstruction.attribute.attribute){
					if(typeof fieldsConstruction.attribute.attribute == 'string'){
						attribute = JSON.parse(fieldsConstruction.attribute.attribute)
					}
				}
			}
			if(fieldsConstruction.datas){
				fieldsConstruction.datas = fieldsConstruction.datas
			}
		}
		
		if(urlData && urlData.fieldsDefaultMaps && typeof urlData.fieldsDefaultMaps[this.fieldKey] != 'undefined'){
			val = urlData.fieldsDefaultMaps[this.fieldKey]
		}
		if(urlData && urlData.row && typeof urlData.row[this.fieldKey] != 'undefined'){
			val = urlData.row[this.fieldKey]
		}
		return {
			selfFieldKey: this.fieldKey,
			selfInputDataObj: this.inputDataObj,
			urlData: urlData,
			fieldsConstruction: fieldsConstruction,
			val: val,
			datas: datas,
			css: css,
			attribute: attribute,
		}
	},
}
